﻿using System.Collections.Generic;

namespace TLang.Parsers
{
    using Ast;

    public static class Extensions
    {
        /// <summary>
        /// 不包括toIndex
        /// </summary>
        /// <param name="list"></param>
        /// <param name="fromIndex"></param>
        /// <param name="toIndex"></param>
        /// <returns></returns>
        public static List<Node> SubList(this List<Node> list, int fromIndex, int toIndex)
        {
            List<Node> results = new List<Node>(toIndex - fromIndex);
            for (int i = fromIndex; i < toIndex; i++)
            {
                results.Add(list[i]);
            }

            return results;
        }
    }
}
